﻿using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System;

/*
 * EditorExt
 * 各种扩展
 *
 *
 * 依赖：
 *
 * ！不写重复代码！
 * @author TTun
 * @date 7/29/2017 11:59:46 AM
 */
public static class EditorExt {

    /// <summary>
    /// 获得prop对应的字段对象
    /// </summary>
    /// <param name="prop"></param>
    /// <returns></returns>
    public static object GetSerializePropertyFieldObj(this SerializedProperty prop) {
        UnityEngine.Object option = prop.serializedObject.targetObject;
        Type t = option.GetType();
        object optionObj = t.GetValueWithPropPath(option, prop.propertyPath);
        return optionObj;
    }
}

